package com.minda.user.web;

import com.minda.user.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by MD-01 on 2017/2/22.
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/info")
    @ResponseBody
    public User info(){
        User user = new User();
        user.setName("戴泽");
        user.setAge(20);
        user.setId(1);
        return user;
    }

    @RequestMapping("/hello")
    public String hello(HttpServletRequest request){

        request.setAttribute("name","刘磊");
        return "hello";
    }

}
